package com.vincent.tvlauncher;

import com.vincent.tvlauncher.view.CellLayoutController;
import com.vincent.tvui.CellLayout;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import java.io.IOException;
import java.io.InputStream;


public class TvLauncher extends AppCompatActivity implements CellLayout.CellClickListener {

    private CellLayout mCellLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tv_launcher);

        mCellLayout = (CellLayout) findViewById(R.id.cellLayout);
        mCellLayout.setController(new CellLayoutController());

        mCellLayout.setCellClickListener(this);

        InputStream inputStream = null;
        try {
            inputStream = getAssets().open("default/layout.json");
            mCellLayout.inflate(inputStream);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (inputStream != null)
                    inputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }


    @Override
    public void onClick(View v) {
        
    }
}
